home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / debhelper / autoscripts / prerm-pycentral < prev    next >
Text File  |  2009-10-11  |  1KB  |  44 lines

  1. case "$1" in remove#UPGRADE#)
  2.     pkgremove=y
  3. esac
  4. if [ -f /var/lib/pycentral/#PACKAGE#.pkgremove ] || [ -f /var/lib/pycentral/pkgremove ]; then
  5.     pkgremove=y
  6. fi
  7. if [ "$pkgremove" = y ]; then
  8. if which python >/dev/null 2>&1 && which pycentral >/dev/null 2>&1; then
  9.     pycentral pkgremove #PACKAGE#
  10. else
  11.     flist=$(tempfile)
  12.     slist=$(tempfile)
  13.     dpkg -L #PACKAGE# | tee $flist | \
  14.     while read n; do
  15.       case "$n" in
  16.         /usr/share/pyshared/*)
  17.           n2=${n#/usr/share/pyshared/*}
  18.           case "$n" in
  19.         *.py) echo "p $n";;
  20.         *) [ -d "$n" ] && echo "d $n2" || echo "f $n2"
  21.           esac
  22.           ;;
  23.         *) continue
  24.       esac
  25.     done > $slist
  26.     if [ -s $slist ]; then
  27.         for d in /usr/lib/python[0-9].[0-9]/????-packages; do
  28.         case "$d" in */python2.1/*|*/python2.2/*) continue; esac
  29.         while read t n; do
  30.             case "$t" in
  31.             p) rm -f $d/$n $d/${n}[co];;
  32.             d) rmdir $d/$n 2>/dev/null || true;;
  33.             *) rm -f $d/$n
  34.             esac
  35.         done < $slist
  36.         done
  37.     fi
  38.         awk '/\/usr\/share\/pyshared/ {next} /\.py$/ {print $0"c\n" $0"o"}' $flist \
  39.         | xargs -r rm -f >&2
  40.     rm -f $flist $slist
  41. fi
  42. rm -f /var/lib/pycentral/#PACKAGE#.pkgremove
  43. fi
  44.